package erfgame.core.graphics.renderer;

import java.awt.Dimension;
import java.awt.Point;


import erfgame.core.Rotation;
import erfgame.core.entity.Entity;

public abstract class AbstractEntityRenderer implements EntityRenderer {
	
	protected Dimension dimension;
	protected Point grabPoint;
	protected int depth;
	private int type;
	private RendererUpdateListener updateListener;
	private Entity entity;
	
	public AbstractEntityRenderer() {
	}
	
	public AbstractEntityRenderer( Dimension dimension, Point grabPoint, int depth ) {
		this();
		this.dimension = dimension;
		this.grabPoint = grabPoint;
		this.depth = depth;
	}
	
	
	public boolean contains(int lx, int ly) {
		// assumes that we have already been bounds-checked
		return true;
	}

	public Dimension getDimension() {
		return this.dimension;
	}
	
	public Point getGrabPoint() {
		return this.grabPoint;
	}
	
	public void setUpdateListener(RendererUpdateListener listener) {
		this.updateListener = listener;
	}
	
	protected void fireUpdate( RendererUpdateType type, Object state ) {
		if( this.updateListener !=  null ) {
			this.updateListener.rendererUpdated( type, state );
		}
	}

	public int getType() {
		return type;
	}
	
	public void setType( int type ) {
		this.type = type;
	}

	public void start() {
		
	}

	public void stop() {
		
	}

	public Entity getEntity() {
		return this.entity;
	}
	
	public void setEntity( Entity entity ) {
		this.entity = entity;
	}

	public int getDepth(Rotation rotation) {
		return this.depth;
	}

}
